<?php


namespace app\zmt\validate;


use think\Validate;

class GoodsValidate extends Validate
{
    protected $rule = [
        'id' => 'require|integer',
        'name' => 'require|max:50',
        'image' => 'require',
        'booklet' => 'require',
        'money' => 'require',
        'gid' => 'require|integer',
    ];
    protected $message = [
        'id.require' => 'id不能为空',
        'name.require' => '商品名称不能为空',
        'name.max:50' => '商品名称最大长度为50',
        'image.require' => '封面图不能为空',
        'booklet.require' => '图集不能为空',
        'money.require' => '运费不能为空',
        'gid.require' => '分类id不能为空',
        'gid.integer' => '分类id参数错误',
    ];
    protected $scene = [
        'add' => ['image','name','money',],
        'edit' => ['id','image','name','money'],
    ];
}